﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Runtime.Serialization;

namespace Fixx.DTO
{
	[Serializable, DataContract(Name = "comment", Namespace = "")]
	public class FixxComment : IFixxDalObject<FixxComment>
	{
		[DataMember(Name = "id", IsRequired = true, Order = 1)]
		public int Id { get; set; }

		[DataMember(Name = "text", IsRequired = true, Order = 2)]
		public string Text { get; set; }

		[DataMember(Name = "createdBy", IsRequired = true, Order = 3)]
		public FixxUser CreatedBy { get; set; }

		[DataMember(Name = "createdAt", IsRequired = true, Order = 4)]
		public DateTime CreatedOn { get; set; }

		public FixxComment() {  }
	
		public string ToXmlString()
		{
			var element =	new XElement("comment",
								new XElement("text", this.Text),
								new XElement("createdAt", DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffffZ"))
							);
			return element.ToString();
		}

	}
}
